<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //while(条件表达式){
      //循环体代码}
      /*   1-100循环
      var a = 1;
      while (a <= 100) {
        console.log(a);
        a++;
      } */
      //1-100  里的偶数 之和
      /*  var a = 1;
      var b = 0;
      while (a <= 100) {
        if (a % 2 === 0) {
          b = b + a;
        }
        a++;
      }
      console.log(b); */
      //   3. 弹出1个弹窗  如果输入的爱你 就返回我也爱你,如果不是则继续弹出
      /*    var a1 = prompt('你爱我吗');
      while (a1 !== '爱你') {
        a1 = prompt('你还爱我吗');
      }
      alert('我也爱你★'); */
      //
      // do while
      do {
        console.log('嘿嘿嘿');
      } while (a > 1);
      //do while   是先执行了再判断是否满足条件   while 则是先判断条件后执行
    </script>
  </body>
</html>
